package cn.edu.ldu.protocol;

import cn.edu.ldu.controller.FriendController;
import cn.edu.ldu.entity.FriendsEntity;
import cn.edu.ldu.util.L;
import cn.edu.ldu.views.operator.Friends;
import com.alibaba.fastjson.JSONObject;

public class AddFriend {
    public AddFriend(Protocol protocol){
        FriendsEntity friendsEntity = JSONObject.parseObject(protocol.getData(),FriendsEntity.class);
        L.OK(friendsEntity,FriendOnline.class);

        new Friends(friendsEntity).setVisible(true);

        //获得新的好友
        FriendController.addToList(friendsEntity);

    }
}
